package com.ls.system.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ls.common.PageModel;

import com.ls.system.entity.SysPermission;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author ls
 * @since 2025-04-15
 */
public interface SysPermissionMapper extends BaseMapper<SysPermission> {

//    Page<SysPermission> selectWithMenu(Page<SysPermission> page, @Param("pm") PageModel pageModel);

    @Select("SELECT p.*, m.title as menu_name " +
            "FROM sys_permission p " +
            "LEFT JOIN sys_menu m ON p.menu_id = m.id " +
            "ORDER BY p.id ASC")
    Page<SysPermission> selectWithMenu(Page<SysPermission> page, @Param("pm") PageModel pageModel);
}
